package business
{
	import com.adobe.cairngorm.business.ServiceLocator;
	
	import mx.collections.ItemResponder;
	import mx.rpc.AsyncToken;
	import mx.rpc.remoting.RemoteObject;

	public class ApplyPayDelegate
	{
		private var responder:Object;
		private var service:RemoteObject;
		
		public function ApplyPayDelegate(re:Object)
		{
			this.service = ServiceLocator.getInstance().getRemoteObject("applyPayService");
			this.responder = re;
		}
		
		/**
		 * 获取申请收费的作品列表
		 * @param status 审核状态
		 * @param page 页数
		 * @param pageSize 每页显示条目
		 * @param orderName 排序字段
		 * @param orderDis 排序规则
		 * @return void
		 */
		public function getList( status:int=0, page:int=1, pageSize:int=10, orderName:String='', orderDis:String='DESC' ):void
		{
			var token:AsyncToken;
			var itemResponder:ItemResponder;
			token = service.getList( status, page, pageSize, orderName, orderDis );
			itemResponder = new ItemResponder(responder['getListResult'], responder['fault']);
			token.addResponder(itemResponder);
		}
		
		/**
		 * 查找作品
		 * @param bid 用户bid
		 * @param assetId 作品ID
		 * @param assetType 作品类型
		 * @param page 页数
		 * @param pageSize 每页显示条目
		 * @param status 审核状态
		 * @param orderName 排序列表(createTime=申请时间，dealTime=处理时间)
		 * @param orderDis 排序规则
		 * @return void
		 */
		public function search(bid:String='', assetId:String='', assetType:String='0', page:int=1, pageSize:int=8, status:int=0, orderName:String="", orderDis:String="DESC"):void
		{
			var token:AsyncToken;
			var itemResponder:ItemResponder;
			token = service.search(bid, assetId, assetType, page, pageSize, status, orderName, orderDis);
			itemResponder = new ItemResponder(responder['getSearchResult'], responder['fault']);
			token.addResponder(itemResponder);
		}
		
		/**
		 * 通过鲜花或者人气排序
		 * @param sortType 排序类型
		 * @param status 审核状态
		 * @parame page 页数
		 * @param pageSize 每页显示条目
		 * @return void
		 */
		public function getBySort(sortType:int=0, status:int=0, page:int=1, pageSize:int=8):void
		{
			var token:AsyncToken;
			var itemResponder:ItemResponder;
			token = service.getBySort(sortType, status, page, pageSize);
			itemResponder = new ItemResponder(responder['getBySortResult'], responder['fault']);
			token.addResponder(itemResponder);
		}
		
		/**
		 * 作品审核
		 * @param assetId 作品id
		 * @param assetType 作品类型
		 * @param status 审核标志
		 * @return void
		 */
		public function audit(assetId:int, assetType:String, status:String):void
		{
			var token:AsyncToken;
			var itemResponder:ItemResponder;
			token = service.audit(assetId, assetType, status);
			itemResponder = new ItemResponder(responder['auditResult'], responder['fault']);
			token.addResponder(itemResponder);
		}
		
		/**
		 * 删除记录
		 * @param assetId 作品id
		 * @param assetType 作品类型
		 * @return void
		 */
		public function deleteAsset(assetId:String, assetType:int):void
		{
			var token:AsyncToken;
			var itemResponder:ItemResponder;
			token = service.deleteAsset(assetId, assetType);
			itemResponder = new ItemResponder(responder["deleteAssetResult"], responder["fault"]);
			token.addResponder(itemResponder);
		}
		
		/**
		 * 添加上架作品
		 * @param assetType 作品类型
		 * @param assetId 作品ID
		 * @return void
		 */
		public function addAsset(assetType:int, assetId:String):void
		{
			var token:AsyncToken;
			var itemResponder:ItemResponder;
			token = service.auditPass(assetId, assetType);
			itemResponder = new ItemResponder(responder["addAssetResult"], responder["fault"]);
			token.addResponder(itemResponder);
		}
/**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ApplyPayAudit的注释函数~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
		public function getWords():void
		{
			var token:AsyncToken;
			var itemResponder:ItemResponder;
			token = service.getWords();
			itemResponder = new ItemResponder(responder["getWordsResult"], responder["fault"]);
			token.addResponder(itemResponder);
		}

		public function setStatus(id:String, type:String, status:String, rejectInfo:String, bPass:int, titleori:String, titlebak:String, adwordsbak:String, catalogbak:String):void
		{
			var token:AsyncToken;
			var itemResponder:ItemResponder;
			token = service.setStatus(id, type, status, rejectInfo, bPass, titleori, titlebak, adwordsbak, catalogbak);
			itemResponder = new ItemResponder(responder["setStatusResult"], responder["fault"]);
			token.addResponder(itemResponder);
		}
		
		public function getDataByPage(page:int, type:String, status:String):void
		{
			var token:AsyncToken;
			var itemResponder:ItemResponder;
			token = service.getDataByPage(page, type, status);
			itemResponder = new ItemResponder(responder["getDataResult"], responder["fault"]);
			token.addResponder(itemResponder);
		}

		public function getDataBySearch(obj:Object, page:int = 0):void
		{
			var token:AsyncToken;
			var itemResponder:ItemResponder;
			token = service.getDataBySearch(obj, page);
			itemResponder = new ItemResponder(responder["getDataResult"], responder["fault"]);
			token.addResponder(itemResponder);
		}

		public function delData(id:String, type:String, msg:String):void
		{
			var token:AsyncToken;
			var itemResponder:ItemResponder;
			token = service.delData(id, type, msg);
			itemResponder = new ItemResponder(responder["delDataResult"], responder["fault"]);
			token.addResponder(itemResponder);
		}
*/
/**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~财务管理~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
		/**
		 * 获取财务转换列表
		 * @param status 审核状态，0=等待、1=通过、2=拒绝
		 * @param page 页数
		 * @param pageSize 每页显示条数
		 * @param orderName 排序字段
		 * @param orderDis 排序规则
		 */
		public function getCashList( status:int=0, page:int=1, pageSize:int=13, orderName:String="", orderDis:String="DESC" ):void
		{
			var token:AsyncToken;
			var itemResponder:ItemResponder;
			token = service.getCashList(status, page, pageSize, orderName, orderDis );
			itemResponder = new ItemResponder(responder["getCashListResult"],responder["fault"] );
			token.addResponder(itemResponder);
		}
		
		/**
		 * 查询财务转换记录(bid,account,accountName三选一)
		 * @param bid 用户id
		 * @param account 用户银行帐号
		 * @param accountName 用户银行帐号名
		 * @param status 审核状态
		 * @param page 页数
		 * @param pageSize 每页显示条数
		 */
		public function searchCash( bid:String, account:String, accountName:String, status:int=0, page:int=1, pageSize:int=13 ):void
		{
			var token:AsyncToken;
			var itemResponder:ItemResponder;
			token = service.searchCash(bid, account, accountName, status, page, pageSize);
			itemResponder = new ItemResponder(responder["searchCashResult"],responder["fault"] );
			token.addResponder(itemResponder);
		}

		/**
		 * 保存审核结果记录
		 * @param id 记录id号
		 * @param status 设置处理状态
		 * @param notes 备注
		 */
		public function auditCash( id:int, status:int, notes:String=""):void
		{
			var token:AsyncToken;
			var itemResponder:ItemResponder;
			token = service.auditCash(id, status, notes);
			itemResponder = new ItemResponder(responder["auditCashResult"],responder["fault"] );
			token.addResponder(itemResponder);
		}
	}
}